package com.apartmentManage.service.impl;

import com.apartmentManage.dao.ApartmentTutorDao;
import com.apartmentManage.entity.ApartmentTutor;
import com.apartmentManage.service.ApartmentTutorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ApartmentTutorServiceImpl implements ApartmentTutorService {

    @Autowired
    private ApartmentTutorDao apartmentTutorDao;

    @Override
    public ApartmentTutor getByRequirement(ApartmentTutor apartmentTutor) {
        return apartmentTutorDao.getByRequirement(apartmentTutor);
    }

    @Override
    public boolean updateByOldPassword(ApartmentTutor apartmentTutor) {
        ApartmentTutor result = getByRequirement(apartmentTutor);
        if (result!=null)
            return false;
        return apartmentTutorDao.updateByOldPassword(apartmentTutor)>0;
    }
}
